package com.lagou.edu.wwyan.nacos.code.dao;

import com.lagou.edu.wwyan.nacos.code.entity.LagouAuthCode;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.time.LocalDateTime;
import java.util.List;

@Repository
public interface LagouAuthCodeDao extends JpaRepository<LagouAuthCode,Integer> {
    /**
     * 查询是否有发送记录
     * @param email
     * @param createtime
     * @return
     */
    int countByEmailAndCreatetimeAfter(String email, LocalDateTime createtime);

    /**
     * 获取有效的验证码
     * @param email
     * @param code
     * @return
     */
    List<LagouAuthCode> getByEmailAndCode(Pageable pageable, String email, String code);
}
